package com.code.leetcode.before50;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/7/23 15:30
 */
public class The55 {
    public boolean canJump(int[] nums) {
        int sum = 0;
        int len = nums.length;
        for (int i = 0; i < len; i++) {
            if (sum > len) return true;
            if (i <= sum) {
                sum = Math.max(sum, nums[i] + i);
            } else {
                return false;
            }
        }
        return true;
    }
}
